using System;
using System.Collections.Generic;
using System.Text;
using Company.BLL;
using Company.BLL.DuLieuChuan;
using Company.BLL.GC;
using Company.BLL.KDT.GC;
using Microsoft.Practices.EnterpriseLibrary.Data.Sql;
using System.Data.SqlClient;
using Microsoft.Practices.EnterpriseLibrary.Data;
namespace Company.BLL.KDT.GC
{
    public class DinhMucDangKyAndDinhMucCollection 
    {
        protected DinhMucCollection dmCollection;
        protected DinhMucDangKy dmDangKy;
        public DinhMucCollection DinhMucColletion
        {
            set { dmCollection = value; }
            get { return dmCollection; }
        }

        //public static DinhMucDangKyAndDinhMucCollection load(long id)
        //{
        //    DinhMucDangKyAndDinhMucCollection dm = new DinhMucDangKyAndDinhMucCollection();
        //    dm.dmDangKy = DinhMucDangKy.Load(id);
        //    dm.dmCollection = DinhMuc.SelectCollectionBy_Master_ID(id);
        //}
        //public static bool InsertUpdate(DinhMucDangKy dmDangKy, DinhMucCollection dmCollection)
        //{
        //    bool ret;
        //    SqlDatabase db = (SqlDatabase)DatabaseFactory.CreateDatabase();
        //    using (SqlConnection connection = (SqlConnection)db.CreateConnection())
        //    {
        //        connection.Open();
        //        SqlTransaction transaction = connection.BeginTransaction();
        //        try
        //        {
        //            bool ret01 = true;
        //            if (dmDangKy.InsertUpdateTransaction(transaction) <= 0)
        //            {
        //                ret01 = false;
        //            }
        //            else
        //            {
        //                foreach (DinhMuc item in dmCollection)
        //                {
        //                    if (item.InsertUpdateTransaction(transaction) <= 0)
        //                    {
        //                        ret01 = false;
        //                        break;
        //                    }
        //                }
        //            }
        //            if (ret01)
        //            {
        //                transaction.Commit();
        //                ret = true;
        //            }
        //            else
        //            {
        //                transaction.Rollback();
        //                ret = false;
        //            }
        //        }
        //        catch
        //        {
        //            ret = false;
        //            transaction.Rollback();
        //        }
        //        finally
        //        {
        //            connection.Close();
        //        }
        //    }
        //    return ret;
        //}		
    }
}
